Skip to main content

All Questions

8votes
5answers
1kviews

Run command on each line of CSV file, using fields in different places of the command

I have a CSV file and want to run a command for each line, using the fields of the file as separate arguments. For example given the following file: foo,42,red bar,13,blue baz,27,green I want to run ...
luator's user avatar
0votes
2answers
92views

Run program only on matching lines

Let's say I have a program blackbox, and a file with the following contents: in this file this line contains =TAG= so does =TAG= this one as =TAG= does this other line this line does ...
wobtax's user avatar
6votes
2answers
1kviews

Why xargs does not process the last argument?

Observe: mark@L-R910LPKW:~$ echo a b | xargs -d' ' -I{} bash -c 'echo {} 1' a 1 b bash: line 2: 1: command not found mark@L-R910LPKW:~$ What is going on?
mark's user avatar
  • 379
-1votes
3answers
469views

How to concatenate several file with * in the path using xargs or parallel

I have a command that fetch a path to a file for each line in a CSV file : awk -F, 'NR>0 {print "/mnt/datagenetique/ANALYSIS/Infectiologie/COVID-WGS/Analyse/" $2 "_*/dragen-covidseq/&...
nstatam's user avatar
17votes
12answers
41kviews

Remove all duplicate word from string using shell script

I have a string like "aaa,aaa,aaa,bbb,bbb,ccc,bbb,ccc" I want to remove duplicate word from string then output will be like "aaa,bbb,ccc" I tried This code Source $ echo "zebra ant spider spider ...
Urvashi's user avatar
1vote
1answer
551views

Interactive remove files listed with paths in text file

I am trying to interactively remove files listed with their paths in a text file. The command I am trying is: xargs rm -i <filelist.txt The error I get is: rm cannot remove 'directory1/...
Mike's user avatar
5votes
3answers
4kviews

cycle through one command's output and use in another command [duplicate]

How can I use the output of one command - line-by-line - into another command? I know how to do this with the | pipe symbol, but this uses the entire output in one command. I would like to go line by ...
d-_-b's user avatar
  • 1,197
12votes
1answer
19kviews

Remove files, which provided by pipe

I have this command chain: find . -print | grep php | xargs grep 'eval' -sl | xargs wc -l | grep ' [1-2][0-9] ' This provide me this output: 14 ./includes/js/calendar/lang/vgju.php 18 ./includes/...
Roland Soós's user avatar

close